<style>
.banner1,.banner2{width: 65%;height: 200px;}
.delt{margin-top: 7%;}
/*项目展示*/
.project-left{margin-top: 2%;}
.project-left img{width: 100%;height: 100%;}
.dlt{position: absolute;right:8%;}
.show{border: 1px solid #fff;  }
.nav-list{width: 12%;margin-left: 2%;}
</style>
<script>
$(function(){
	<?php if($type==1){?>
		$("#nav_list").val(1);
	<?php }else{?>
		$("#nav_list").val(2);
	<?php }?>

	$("#nav_list").on("change",function(){
		var type=$(this).val();
		$.ajax({
			// 后台的地址
			url:"{:U('Index/ajaxGetProject')}",
			// ajax传输的方法
			type:"post",
			// 前端发送到后端的数据
			data:{"type":type},
			// 成功过后做的事情function里的参数就是后台返回回来的数据
			success:function(data){
				var str="";
				for (var i = 0; i < data.length; i++) {
					str+='<div class="col-xs-12 col-md-6 col-lg-2 project-left">';
					str+='<a href="{:U('Index/projectDel')}&id='+data[i].id+'" class="pull-right dlt "><span class="glyphicon glyphicon-remove dlt"></span></a>';
					str+='<img src="'+data[i].imgurl+'" alt="">';
					str+='</div>';
				}
				$("#project_content").html(str);
			}
		});
	})
})
</script>
<!--html-->
<div class="row">
	<ol class="breadcrumb">
		<li><a href="{:U('Index/index')}"><span class="glyphicon glyphicon-home"></span></a></li>
		<li class="active">首页设置</li>
	</ol>
</div><!--/.row-->

<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">banner设置</h1>
	</div>
</div><!--/.row-->

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-body tabs">
				<ul class="nav nav-pills">
					<?php foreach($bannerlist as $k=>$v){ ?>
					<li <?php if($k==0){ echo"class=\"active\""; }?> ><a href="#pilltab<?php echo $k;?>" data-toggle="tab">banner <?php echo $k+1;?></a></li>
					<?php } ?>
				</ul>
				<div class="tab-content">
					<?php foreach($bannerlist as $k=>$v){ ?>
					<div class="tab-pane fade <?php if($k==0){ echo 'active in'; }?>" id="pilltab<?php echo $k;?>">
						<img src="<?php echo $v['imgurl'];?>" alt="" class="banner1"/>
						<a href="<?php echo U('Index/bannerDel',array('id'=>$v['id']))?>" class="pull-right delt"><span class="glyphicon glyphicon-remove"></span></a>
					</div>
					<?php } ?>
				</div>

				<form class="col-lg-12" action="{:U('Index/bannerset')}" method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label>上传图片</label>
						<input type="file" name="banner">
						<p class="help-block">图片大小<2M</p>
						<button type="submit" class="btn btn-primary">确定</button>
					</div>
				</form>
				<!--项目展示-->
				<h1 class="page-header">项目展示</h1>
				<select class="form-control nav-list" name="type" id="nav_list" form="form">
					<option value="1" >UI</option>
					<option value="2" >HTML5</option>
				</select>
				<div id="project_content">
					<?php foreach($projectlist as $k=>$v){ ?>
					<div class="col-xs-12 col-md-6 col-lg-2 project-left <?php if($k==i){ echo 'active in'; }?>">
						<a href="<?php echo U('Index/projectDel',array('id'=>$v['id']))?>" class="pull-right dlt "><span class="glyphicon glyphicon-remove dlt"></span></a>
						<img src="<?php echo $v['imgurl'];?>" alt="">
					</div>
					<?php } ?>
				</div>
				<form class="col-lg-12" action="{:U('Index/projectshow')}" method="post" enctype="multipart/form-data" id="form">
					<div class="form-group">
						<label>上传图片</label>
						<input type="file" name="project">
						<p class="help-block">图片大小<2M</p>
						<button type="submit" class="btn btn-primary">确定</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>